// src/stores/auth.store.js
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import {getBaseInfo, getUserInfo} from "@/api/api.js";


export const useUserStore = defineStore('user', () => {
    const userInfo = ref({})
    // const userStatistic = ref(() => {})
    // const setUserInfo = (info) => {
    //     userInfo.value = info
    // }
    // const setUserStatistic = async () => {
    //     const res = await getBaseInfo()
    //     console.log(res)
    //     userStatistic.value = res.data
    // }
    const setUserInfo = (data) => {
        userInfo.value = data
    }

    const setUserAvatar = (url) => {
        // console.log("头像？？？")
        userInfo.value.userAvatar = url
    }
    return {
        userInfo,
        setUserInfo,
        setUserAvatar,
    }
},{
    persist: true
})